<%@page pageEncoding="UTF-8" isELIgnored="false"%>
<%@taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%@taglib prefix="f" uri="http://www.slim3.org/functions"%>
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt" %>
<%@ taglib prefix="m" uri="http://taglibs.mobylet.org/" %>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=<m:charset/>" />
<title>なかまちず</title>
<c:import url="/jsp/pc/keyword.jsp"/>
<link rel="stylesheet" type="text/css" href="/css/global.css" />
<style type="text/css">
  html { overflow: auto; }
  html, body, td, th { font-family: Arial, sans-serif; margin: 0px; padding: 0px; height: 100%; font-size: 10pt; color: #333333; }
  .text { font-family: Arial, sans-serif; margin: 0px; padding: 0px 10px; height: 100%; font-size: 10pt; color: #333333; }
  #map { position: absolute; top: 30px; left: 10px; width: 600px; height: 450px;}
  #map img { cursor: crosshair; }
  img { border: 0px; }
  form { margin: 0; padding: 0; font-family: Arial, sans-serif; font-size: 10pt; }
  input, textarea { margin: 3px 0 0 0; padding: 0; font-family: Arial, sans-serif; font-size: 10pt; }
  #side_bar { position: absolute; top: 6px; left: 620px; border: 1px solid #666; padding: 5px; line-height: 1.8; overflow:auto; background: url(/icon/white70per.png); width: 150px; height: 462px; }
  #header { background-color: #ffffff; position:absolute; top: 6px; left: 10px; z-index: 99; width: 592px; padding: 2px 4px; overflow: hidden; }
  div.errors { color: red; font-weight: bold; position: absolute; top: 35px; left: 15px; border: 1px solid #666; padding: 0px 5px; overflow:auto; background: url(/icon/white70per.png); width: 300px; height: 60px; }
  #main { background-color: #ffffff; font-size: 10pt; position: relative; top: 0px; left: 0px; border: 0px solid #666; }
  #body { background-color: #ffffff; font-size: 10pt; border: 1px solid #666; width: 763px; padding: 2px 4px; margin: 10px;}
  #list { background-color: #ffffff; font-size: 10pt; border: 1px solid #666; width: 763px; padding: 2px 4px; margin: 10px; }
  #help { background-color: #ffffff; font-size: 10pt; width: 759px; height: 120px; padding: 2px 4px; margin: 10px; border: 3px solid #99b3cc; }
  #copy { font-size: 8pt; position: absolute; top: 490px; left: 650px; }
  #footer { font-size: 8pt; position: absolute; top: 950px; left: 10px; }
  #adsense { font-size: 10pt; position: absolute; top: 10px; left: 790px; }
</style>
<script type="text/javascript">
<!--
	function delConfirm(form, name){
		if(window.confirm(name+'さんを削除しますか？')){
			form.submit();
		}else{
			return false;
		}
	}
// -->
</script>
</head>
<body>

<c:if test="${!empty errors}">
<p style="font-weight: bold; margin: 10px;">いくつかのエラーが発生しました。下記メッセージを確認してください。</p>
<ul style="color: red; font-weight: bold;">
<c:forEach var="e" items="${f:errors()}">
 <li>${f:h(e)}</li>
</c:forEach>
</ul>
</c:if>

<c:if test="${!empty messages}">
<br/>
<ul style="color: blue; font-weight: bold;">
<c:forEach var="m" items="${messages}">
 <li>${f:h(m)}</li>
</c:forEach>
</ul>
</c:if>


<div id="body"><!-- start body -->

<h1>新規メンバー登録</h1>
<br/>

<form name="sendMailForm" action="/member" method="post">

<table>
 <tr>
  <td width="300px">
  <h2>ニックネーム</h2>
  <p class="indent">
  <input type="text" size="25" ${f:text("name")} class="${f:errorClass("name", "err")}"/>
  </p>
  </td>
 </tr>
 <tr>
  <td>
  <h2>メールアドレス</h2>
  <p class="indent">
  <input type="text" size="50" ${f:text("to")} class="${f:errorClass("to", "err")}"/>
  </p>
  </td>
 </tr>
 <tr>
  <td colspan="2">
  <h2>
  &nbsp;&nbsp;&nbsp;
  <input type="submit" name="cmd_add" value="追加する">
  </h2>
  </td>
 </tr>
</table>

</form>
</div><!-- end body -->
<div id="list"><!-- start list -->

<h1>登録済メンバー一覧</h1>
<br/>

<table>
 <tr>
  <td width="30px">&nbsp;</td>
  <td width="120px"><h2>ニックネーム</h2></td>
  <td width="300px"><h2>メールアドレス</h2></td>
  <td width="120px"><h2>削除</h2></td>
 </tr>
 
<c:if test="${!empty memberList}">
<c:forEach var="mem" items="${memberList}" varStatus="status">
 <tr>
  <td align="center">${status.index + 1}</td>
  <td>
  <p>${f:h(mem.name)}</p>
  </td>
  <td>
  <p>${f:h(mem.mailAddress)}</p>
  </td>
  <td>
  <form name="deleteForm" action="/member" method="post">
  <input type="hidden" name="id" value="${f:h(mem.keyStr)}"/>
  <input type="submit" value="削除する" name="cmd_del" onClick="delConfirm(this, '${f:h(mem.name)}'); return false;"/>
  </form>
  </td>
 </tr>
</c:forEach>
</c:if>

<c:if test="${empty memberList}">
 <tr>
  <td colspan="4">
  メンバーはまだ登録されていません。
  </td>
 </tr>
</c:if>
</table>
</div><!-- end list -->

<div style="margin: 10px;">
<a href="/view">地図へ戻る</a>
</div>

<div id="adsense">
<c:import url="/jsp/pc/adsense.jsp"/>
</div>

<c:import url="/jsp/pc/analytics.jsp"/>
</body>
</html>